/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.videoRenter.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author 211227307
 */
@Entity
public class Customer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    private String notes;
    private boolean active;

    @Embedded
    private CustName custName;
    @Embedded
    private CustDetails custDetails;
    @Embedded
    private CustBalance custBalance;
    
    @OneToMany (cascade=CascadeType.ALL, orphanRemoval = true)
    private List<CustAddress> custAddress;
    @OneToMany (cascade=CascadeType.ALL, orphanRemoval = true)
    private List<CustPhone> custPhone;
    @OneToMany (cascade=CascadeType.ALL, orphanRemoval = true)
    private List<CustEmail> custEmail;
    
    @OneToMany (cascade=CascadeType.ALL, orphanRemoval = true)
    private List<RentalHistory> rentalHistory;
    @OneToMany (cascade=CascadeType.ALL, orphanRemoval = true)
    private List<Booking> booking;
    @OneToMany (cascade=CascadeType.ALL, orphanRemoval = true)
    private List<Txn> txn;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public CustName getCustName() {
        return custName;
    }

    public void setCustName(CustName custName) {
        this.custName = custName;
    }

    public CustDetails getCustDetails() {
        return custDetails;
    }

    public void setCustDetails(CustDetails custDetails) {
        this.custDetails = custDetails;
    }

    public CustBalance getCustBalance() {
        return custBalance;
    }

    public void setCustBalance(CustBalance custBalance) {
        this.custBalance = custBalance;
    }

    public List<CustAddress> getCustAddress() {
        return custAddress;
    }

    public void setCustAddress(List<CustAddress> custAddress) {
        this.custAddress = custAddress;
    }

    public List<CustPhone> getCustPhone() {
        return custPhone;
    }

    public void setCustPhone(List<CustPhone> custPhone) {
        this.custPhone = custPhone;
    }

    public List<CustEmail> getCustEmail() {
        return custEmail;
    }

    public void setCustEmail(List<CustEmail> custEmail) {
        this.custEmail = custEmail;
    }

    public List<RentalHistory> getRentalHistory() {
        return rentalHistory;
    }

    public void setRentalHistory(List<RentalHistory> rentalHistory) {
        this.rentalHistory = rentalHistory;
    }

    public List<Booking> getBooking() {
        return booking;
    }

    public void setBooking(List<Booking> booking) {
        this.booking = booking;
    }

    public List<Txn> getTxn() {
        return txn;
    }

    public void setTxn(List<Txn> txn) {
        this.txn = txn;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "za.ac.cput.videoRenter.domain.Customer[ id=" + id + " ]";
    }
    
}
